package com.zmn.plat.common.dictionary;

/**
 * 1不允许，2允许
 *
 * @author xiangjunming
 * @since 2020/03/26 14:56:30
 */
public enum ChannelOrderConfigEnum {

    /**
     * 1不允许，2允许
     */
    ALLOW(ChannelOrderConfigEnum.CONSTS_CHANNEL, "不允许"),
    NOT_ALLOW(ChannelOrderConfigEnum.CONSTS_CUSTOMER, "允许");

    /**
     * 1不允许
     */
    public final static int CONSTS_CHANNEL = 1;
    /**
     * 2允许
     */
    public final static int CONSTS_CUSTOMER = 2;

    private Integer code;
    private String name;

    ChannelOrderConfigEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getName(Integer code) {
        ChannelOrderConfigEnum of = of(code);
        return of == null ? null : of.getName();
    }

    public static ChannelOrderConfigEnum of(Integer code) {
        switch (code) {
            case 1:
                return ALLOW;
            case 2:
                return NOT_ALLOW;
            default:
                return null;
        }
    }
}
